package org.zcl.日期;

import org.apache.commons.lang3.time.DateFormatUtils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Package org.zcl.日期
 * @PROJECT_NAME: question
 * @DESCRIPTION: https://www.cnblogs.com/jpfss/p/11214676.html
 * @USER: zhuchenglin
 * @DATE: 2021/12/15 10:33
 */
public class CompareDate {

    public static void main(String[] args) throws ParseException {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date currentDate = new Date();
        Date date = simpleDateFormat.parse("2021-12-14 23:59:59");
        if (date.compareTo(currentDate) < 0) {
            System.out.println(date + "<" + currentDate);
        }

        Date date2 = simpleDateFormat.parse("2021-12-15 23:59:59");
        if (date2.compareTo(currentDate) == 0) {
            System.out.println(date2 + "=" + currentDate);
        }

        Date date3 = simpleDateFormat.parse("2021-12-16 23:59:59");
        if (date3.compareTo(currentDate) > 0) {
            System.out.println(date3 + ">" + currentDate);
        }
    }
}
